package com.example.demo.pdfbox.tabel;

import com.example.demo.pdfbox.common.enums.HorizontalAlignment;
import com.example.demo.pdfbox.common.enums.VerticalAlignment;
import com.example.demo.pdfbox.tabel.concrete.PdfText;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Getter
public class PdfParagraph extends PdfElement implements Serializable {
    @Setter
    private int rowNum;
    /**
     * 行距
     */
    private float spaced=0;
    /**
     * 文字位置（水平）
     */
    private HorizontalAlignment horizontalAlignment = HorizontalAlignment.CENTER;
    /**
     * 文字位置（垂直）
     */
    private VerticalAlignment verticalAlignment = VerticalAlignment.CENTER;
    /**
     * 自动换行
     */
    private boolean autoLine = true;
    /**
     * 自动大小
     */
    private boolean autoSize = false;
    private List<PdfText> textList;
    @Setter
    private List<List<PdfText>> rowItems;


    public PdfParagraph() {
        this.textList = new ArrayList<>();
    }

    public PdfParagraph setTextList(List<PdfText> textList) {
        this.textList = textList;
        return this;
    }

    public PdfParagraph addTextList(PdfText text) {
        this.textList.add(text);
        return this;
    }

    public PdfParagraph setSpaced(float spaced) {
        this.spaced = spaced;
        return this;
    }

    public PdfParagraph setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
        this.horizontalAlignment = horizontalAlignment;
        return this;
    }

    public PdfParagraph setVerticalAlignment(VerticalAlignment verticalAlignment) {
        this.verticalAlignment = verticalAlignment;
        return this;
    }

    public PdfParagraph setAutoLine(boolean autoLine) {
        this.autoLine = autoLine;
        return this;
    }

    public PdfParagraph setAutoSize(boolean autoSize) {
        this.autoSize = autoSize;
        return this;
    }
}
